<template>
  <a-card :bordered="false" style="height:100%;padding-bottom:200px; ">

    <div class="table-page-search-wrapper">
      <a-form layout="inline" :form="form">

        <!-- 功能示例：关闭当前页面 -->
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="功能示例：关闭当前页面">
              <a-button type="primary" @click="handleCloseCurrentPage">点击关闭当前页面</a-button>
            </a-form-item>
          </a-col>
        </a-row>
        <!-- 功能示例：微服务调用 -->
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="功能示例：微服务调用">
              <a-button type="primary" @click="handleCallInfo">CALL</a-button>
            </a-form-item>
          </a-col>
        </a-row>
        <!-- 功能示例：跨服务调用 -->
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="功能示例：跨服务调用">
              <a-button type="primary" @click="handleOtherCallInfo">CALL</a-button>
            </a-form-item>
          </a-col>
        </a-row>

      </a-form>
    </div>

  </a-card>
</template>

<script>
  import {putAction,getAction} from '@lone/lone-vue/src/api/manage';

  export default {
    name: 'CloudDemo',
    inject:['closeCurrent'],
    components: {

    },
    data() {
      return {
        form: this.$form.createForm(this),

        modal: {
          title: '这里是标题',
          visible: false,
          fullscreen: true,
          switchFullscreen: true,
        },

      }
    },
    computed: {

    },
    methods: {
      handleCloseCurrentPage() {
        // 注意：以下代码必须存在
        // inject:['closeCurrent'],
        this.closeCurrent()
      },
      handleCallInfo() {
        let that = this;
        getAction('/nacosdemo/hello/feign', {'token':'tokenVal'}).then((res) => {
          that.$message.success(res);
          // if (res.success) {
          //   that.$message.success(res.message);
          // } else {
          //   that.$message.warning(res.message);
          // }
        })
      },
      handleOtherCallInfo() {
        let that = this;
        getAction('/demoapi/sysApi/info/lone', {'code':'tokenVal'}).then((res) => {
          if (res.success) {
            that.$message.success(res.message + res.result.requestUrl);
          } else {
            that.$message.warning(res.message);
          }
        })
      },
    }
  }
</script>
<style lang="less" scoped>
  .ant-card-body .table-operator {
    margin-bottom: 18px;
  }

  .ant-table-tbody .ant-table-row td {
    padding-top: 15px;
    padding-bottom: 15px;
  }

  .anty-row-operator button {
    margin: 0 5px
  }

  .ant-btn-danger {
    background-color: #ffffff
  }

  .ant-modal-cust-warp {
    height: 100%
  }

  .ant-modal-cust-warp .ant-modal-body {
    height: calc(100% - 110px) !important;
    overflow-y: auto
  }

  .ant-modal-cust-warp .ant-modal-content {
    height: 90% !important;
    overflow-y: hidden
  }
</style>